#include <btnInterface.h>

btnInterface::btnInterface(QWidget* parent) : QWidget(parent)
{
	ui.setupUi(this);
    ui.map->installEventFilter(this);
}

bool btnInterface::eventFilter(QObject* object, QEvent* event)
{
    if (object == ui.map)
    {
        if (event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
            if (mouseEvent->button() == Qt::LeftButton)
            {
                QPoint pointPos;
                pointPos = mouseEvent->globalPos();
                pointPos = ui.map->mapFromGlobal(pointPos);
                qDebug() << pointPos << endl;
                return true;
            }
            else return false;
        }
        else return false;
    }
    else return false;
}
